<%@ LANGUAGE="VBSCRIPT" %>
<% option explicit%>
<% Response.Expires=0 %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%
dim Node, Tel
Node=request("Node")
if isEmpty(Node) then Node="_P"
Tel=request("Tel")

%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">

<script>
var tm="";

function Reloading() {
if (top.ReviewFlag) location=location.pathname+"?Node=<%=Node%>&Tel=<%=Tel%>";
	};

function TopReloading(t) {
top.location=top.location.pathname+"?Node=<%=Node%>&Tel="+t;
	};

function Cycle() {
tm=setInterval("Reloading()",3000);
};


</script>
</head>

<body bgcolor="#FBF3BB" onload="Cycle();" >
<%
	Dim cnn
	Dim i, Color1,Color2, color, size, TT
	Dim connStr
	Dim objRec, cmdM
	Set cnn=Server.CreateObject("ADODB.Connection")
	Set objRec=Server.CreateObject("ADODB.Recordset")
	connStr="Provider=SQLOLEDB.1;Persist Security Info=True;User ID=Test;Password=Test;Initial Catalog=SMS"&Node&";Data Source=(local)"
	cnn.open connStr

	Set cmdM=Server.CreateObject("ADODB.Command")
	Set cmdM.ActiveConnection = cnn
	'cmdM.CommandText = "use sms exec sp_setapprole 'rl_appTesting', 'appTesting'"
'cmdM.execute
'set cmdM=nothing

	''''i=1
	if Tel="" THEN
		objRec.open "select * from SMS_p.dbo.[View_Answers] ", cnn,1,3,1
	ELSE
		objRec.open "select * from SMS_p.dbo.[View_Answers] where Address='"&Tel&"'", cnn,1,3,1
	END IF
	
	%>
	<table border="1" width="98%" align="center" cellpadding=4>
	<tr align="center">
<th  align="center"><table  height="16"  width="16"><tr><td bgcolor="#FF0000" id="FC">&nbsp;</td></tr></table></th>
<th><font size=-1>SMSTime</font></th>
<th><font size=-1><u style="cursor:hand;"><a onclick="TopReloading('');">Phone</a></u></font></th>
<th><font size=-1>SMS</font></th>
<th><font size=-1>ProTime</font></th>
<th><font size=-1>Comment</font></th>
<th><font size=-1>Answer</font></th>
<!--<th><font size=-1>AnswerTime</font></th>-->
<th><font size=-1>SentTime</font></th>
</tr>
	<%
	Do while (Not objRec.eof) ''''AND i<=12
TT="&nbsp;"
A=""
''''IF UCASE(Left( objRec("Answer_Message"),6))="SMSPAY"  and UCASE(objrec("Comment"))<>"CM ACCEPTED" THEN 
IF UCASE(Left( objRec("Answer_Message"),6))="SMSPAY"  OR UCASE(Left( objRec("Answer_Message"),7))="SMSKENO" THEN 
	Color1="#c0c0c0" 
	Color2="Brown" 
	size="-3"
ELSE 
	Color1="Black" 
	Color2="Black"
	size="-1"
end IF
DIM Answer, A, SMSTime
Answer=objRec("Answer_Message")
IF isNULL(Answer)  THEN Answer=""
SMSTime=objRec("SMSTime")
if isNULL(SMSTime) THEN 
SMSTime=""
ELSE 
SMSTime="<u>"&Replace(SMSTime,",","<br>") & "</u><br>"
end if
    %>
	<tr align="center">
<td><font size=-2><%= objRec("ID") %></font></td>
<td><font size=-2>
<%=SMSTime%>
<%=objRec("GetTime")   %>
</font></td>
<td><font size=-1><b><u  style="cursor:hand;"><a onclick="TopReloading('<%= objRec("Address")  %>');"><%= objRec("Address")  %></a></u></b></font></td>
<td align=left><font size=-3 color=<%=Color1%> ><%= Replace(Replace(objRec("SMS_Message"),"*","<wbr>*"),"#","<WBR>#")%>&nbsp;</font></td>
<%
IF NOT isNULL(objRec("SMS_ProTime")) THEN TT="<u>"&FormatdateTime(objRec("SMS_ProTime"),vbLongTime)&"</u>&nbsp;"
IF NOT isNULL(objRec("ProTime")) THEN TT=TT&"<br>"&FormatdateTime(objRec("ProTime"),vbLongTime)&"&nbsp;"
%>
<td><font size=-2><%=TT%></font></td>
<%
%>
<td><font size=-2><%=objRec("Comment")%>&nbsp;<%=objRec("SMS_Comment")%></font></td>
<%if UCASE(objrec("Status"))<>"3" AND  (UCASE(Left(Answer,6))="SMSPAY" OR UCASE(Left(Answer,7))="SMSKENO") THEN 
Color2="Green"
A="Accepted: "%>
<!--
<%''if UCASE(objrec("StatusDescr"))="CM ACCEPTED"  THEN%>
<td align=left><font size=<%=sIZE%> color=<%=Color2%> >[+]&nbsp;</font></td>
<  %ELSE%>
-->
<%END IF%>
<td align=left><font size=<%=sIZE%> color=<%=Color2%> ><%=A%><%= Replace(Replace(Answer,"<","&lt;"),">","&gt;")  %>&nbsp;</font></td>
<!--<td><font size=-2><%=objRec("Answer_ProTime")   %>&nbsp;</font></td>-->
<%
dim cl, Num, Nt
Nt=""
IF Int(objRec("Num"))< -2 THEN 
	Num="<br><font size=-1><b>"&objRec("Num")&"</b></font>"
	cl="Brown"
ELSE 
	Num=""
	IF Int(objRec("Num"))> -1 THEN NT="title="""&objrec("Num")&""""
	cl="Black"
END IF
Color="Black"
IF objRec("Result")="Test OK" THEN Color="Green"
IF objRec("Result")="Test FAILED" THEN Color="Red"
IF objRec("Result")="Check it!" THEN Color="Blue"
IF objRec("Result")="No SMS command" THEN Color="Brown"
dim t
t=objRec("SentTime")&Num&"<br><font size=-2 color="&Color&">"&objrec("Result")

if not isNULL(t) THEN t=Replace(t," [","<br>[") end if
%>
<td <%=Nt%>><font size=-2 color="<%=Cl%>"><%=t%>&nbsp;</font></font></td></tr>
<%
	objRec.MoveNext
	''''i=i+1
	Loop 
	%>
	</table>
		<%
	cnn.Close
	set cnn=nothing
	set objRec=nothing
%>
</font>
<script>
if (top.ReviewFlag) document.all["FC"].bgColor="#95CD70"
else document.all["FC"].bgColor="red";
</script>
</body>
</html>
